package com.bootdo.analyze.service.impl;

import com.bootdo.analyze.dao.ClientSellAIDao;
import com.bootdo.analyze.dao.GoodsSellAIDao;
import com.bootdo.analyze.domain.ClientSellAIDO;
import com.bootdo.analyze.domain.GoodsSellAIDO;
import com.bootdo.analyze.service.ClientSellAIService;
import com.bootdo.analyze.service.GoodsSellAIService;
import com.bootdo.analyze.util.Dto;
import com.bootdo.analyze.util.DtoUtil;
import com.bootdo.analyze.util.WeiDuUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class ClientSellAIServiceImpl implements ClientSellAIService {
    @Autowired
    private ClientSellAIDao clientSellAIDao;



    @Override
    public int count(Map<String, Object> map) {
        return clientSellAIDao.count(map);
    }

    @Override
    public List<ClientSellAIDO> getClientFluctuate(Map<String,Object> map) {
        List<ClientSellAIDO> clientSellAIDOList = clientSellAIDao.getClientFluctuate(map);
        for (ClientSellAIDO clientSellAIDO:clientSellAIDOList){
            int id = clientSellAIDO.getId();
            String str_salescount=clientSellAIDao.getSalescount(id);
            if (str_salescount==null || str_salescount==""){
                str_salescount="0";
            }
            clientSellAIDO.setSalescount(Integer.parseInt(str_salescount));
            String str_totalPrices=clientSellAIDao.getTotalPrices(id);
            if (str_totalPrices==null || str_totalPrices==""){
                str_totalPrices="0";
            }
            clientSellAIDO.setTotalPrices(Double.parseDouble(str_totalPrices));



        }
        return clientSellAIDOList;


    }



}
